home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
biz
/
dbase
/
carcosts.lha
/
CarCosts
/
Source
/
Init.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-02
|
12KB
|
333 lines
#include "demo.h"
#include "Daten.h"
#include <exec/memory.h>
/* Ein kleines Makro für ein Label */
#define MyLabel2(label,char) TextObject, MUIA_Text_PreParse, "\33r", \
MUIA_Text_HiChar, char, \
MUIA_Text_Contents, label, \
MUIA_Weight, 0, \
MUIA_InnerLeft, 0, \
MUIA_InnerRight, 0, \
StringFrame, \
MUIA_FramePhantomHoriz, TRUE, \
End
/* Makro ende */
#define MyText(cont) TextObject, TextFrame, \
MUIA_Text_Contents, cont, \
MUIA_Text_PreParse , "\33r", \
End
#define MyString(len, key) StringObject, MUIA_String_MaxLen, len, \
MUIA_ControlChar, key, \
MUIA_String_Format, MUIV_String_Format_Right, \
StringFrame, End
#define MyInt(len, key) StringObject, MUIA_String_MaxLen, len, \
MUIA_ControlChar, key, \
MUIA_String_Accept, "1234567890", \
MUIA_String_Format, MUIV_String_Format_Right, \
StringFrame, End
#define MyFloat(len, key) StringObject, MUIA_String_MaxLen, len, \
MUIA_ControlChar, key, \
MUIA_String_Accept, "-1234567890.", \
MUIA_String_Format, MUIV_String_Format_Right, \
StringFrame, End
char *Formate[] =
{
"FORMAT_DOS",
"FORMAT_INT",
"FORMAT_USA",
"FORMAT_CDN",
"FORMAT_LOCALE",
NULL
};
Object * App ; /* Application object */
Object * WI_Cost; /* Window object */
Object * WI_Treib; /* Treibstoffdatenfenster */
Object * WI_Unter; /* Unterhaltsdatenfenster */
Object * TX_Gad1; /* Main-Window, oberster Textbereich */
Object * TX_Gad2; /* Main-Window, zweiter Textbereich */
Object * BT_Treib; /* Treibstoffdaten eingeben */
Object * BT_Unter; /* Unterhaltsdaten eingeben */
Object * TX_Gad3; /* Unterhalt ges. */
Object * TX_Gad4; /* Unterhalt je km */
Object * TX_Gad5; /* Treibst. ges */
Object * TX_Gad6; /* Treibst. je km */
Object * TX_Gad7; /* Kosten ges */
Object * TX_Gad8; /* Kosten je km */
Object * TX_Gad9; /* Kilometer */
Object * TX_Gad10; /* Liter */
Object * TX_Gad11; /* Verbrauch */
Object * LI_Treib; /* Treibstoffliste */
Object * LV_Treib; /* Treibstofflistview */
Object * LI_Unter; /* Unterhaltsliste */
Object * LV_Unter; /* Unterhaltslistview */
Object * ST_Gad1; /* Treib Datum */
Object * ST_Gad2; /* Treib kmstand */
Object * ST_Gad3; /* Treib Liter */
Object * ST_Gad4; /* Treib Preis */
Object * BT_TR_New;
Object * BT_TR_Change;
Object * BT_TR_Delete;
Object * BT_TR_Cancel;
Object * BT_TR_Close;
Object * BT_UN_New;
Object * BT_UN_Change;
Object * BT_UN_Delete;
Object * BT_UN_Cancel;
Object * BT_UN_Close;
Object * ST_Gad5; /* Unter Datum */
Object * ST_Gad6; /* Unter Preis */
Object * ST_Gad7; /* Unter Titel */
Object * ST_Gad8; /* Unter Bemerkung */
Object * WI_Neu;
Object * NE_Gad1;
Object * NE_Gad2;
Object * NE_Gad3;
Object * NE_Gad4;
Object * NE_OK;
Object * NE_Cancel;
Object * NE_Title;
LONG changes;
struct Hook Hook_conhooktreib, Hook_deshooktreib;
struct Hook Hook_cmphooktreib, Hook_disphooktreib;
struct Hook Hook_conhookunter, Hook_deshookunter;
struct Hook Hook_cmphookunter, Hook_disphookunter;
struct NewMenu NewMenu[] =
{
{
NM_TITLE, (char *)MSG_PROJECT_MENU , 0 ,0,0,(APTR)0
}
,
{
NM_ITEM , (char *)MSG_PROJECT_NEW ,0,0,0,(APTR)ID_MENUNEU
}
,
{
NM_ITEM , (char *)MSG_PROJECT_CHANGEDATE,0,0,0,(APTR)ID_MENUCHANGE
}
,
{
NM_ITEM , (char *)MSG_PROJECT_LOAD,0,0,0,(APTR)ID_LOAD
}
,
{
NM_ITEM , (char *)MSG_PROJECT_INSERT,0,0,0,(APTR)ID_INSERT
}
,
{
NM_ITEM , (char *)MSG_PROJECT_SAVE, 0 ,0,0,(APTR)ID_SAVE
}
,
{
NM_ITEM , (char *)MSG_PROJECT_SAVEAS,0,0,0,(APTR)ID_SAVEAS
}
,
{
NM_ITEM , (char *)MSG_PROJECT_PRINT ,0,0,0,(APTR)ID_PRINT
}
,
{
NM_ITEM , (char *)MSG_PROJECT_ABOUT ,0,0,0,(APTR)ID_ABOUT
}
,
{
NM_ITEM , NM_BARLABEL, 0 ,0,0,(APTR)0
}
,
{
NM_ITEM , (char *)MSG_PROJECT_QUIT, 0,0,0,(APTR) ID_QUIT
}
,
{
0,0
}
};
/*************************************************************************
*************************************************************************
*************************************************************************
Function: MyInit()
Initializes MUI, opens main window.
Return: LONG
0: Error
Author: Rüdiger Dreier
History:
01.10.1993: Initial version
*************************************************************************
*************************************************************************
*************************************************************************/
LONG MyInit(VOID)
{
App = 0;
Hook_conhooktreib.h_Entry = (unsigned long (*)())conhooktreib;
Hook_deshooktreib.h_Entry = (unsigned long (*)())deshooktreib;
Hook_cmphooktreib.h_Entry = (unsigned long (*)())cmphooktreib;
Hook_disphooktreib.h_Entry = (unsigned long (*)())disphooktreib;
Hook_conhookunter.h_Entry = (unsigned long (*)())conhookunter;
Hook_deshookunter.h_Entry = (unsigned long (*)())deshookunter;
Hook_cmphookunter.h_Entry = (unsigned long (*)())cmphookunter;
Hook_disphookunter.h_Entry = (unsigned long (*)())disphookunter;
#include "Init.h"
if (App)
{
DoMethod(WI_Cost,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
App,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
DoMethod(WI_Treib,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
App,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
DoMethod(WI_Unter,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
App,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
DoMethod(WI_Neu,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
App,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
DoMethod(BT_Treib, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_TREIB);
DoMethod(BT_Unter, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_UNTER);
/* Fenster für neue Datei */
DoMethod(NE_OK, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_NE_OK);
DoMethod(NE_Cancel, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_NE_CANCEL);
DoMethod(NE_Gad3, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_NE_KM);
DoMethod(NE_Gad1,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Neu,3,MUIM_Set,MUIA_Window_ActiveObject,NE_Gad2);
DoMethod(NE_Gad2,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Neu,3,MUIM_Set,MUIA_Window_ActiveObject,NE_Gad3);
/* Buttons im Treibstoffenster */
DoMethod(BT_TR_New, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_TR_NEW);
DoMethod(BT_TR_Change, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_TR_CHANGE);
DoMethod(BT_TR_Delete, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_TR_DELETE);
DoMethod(BT_TR_Cancel, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_TR_CANCEL);
DoMethod(BT_TR_Close, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
DoMethod(ST_Gad1, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_TR_DATE);
DoMethod(ST_Gad4, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_TR_PRICE);
/* Stringgadgets im Treibstoffenster verbinden */
/* Außer Datum und Preis */
DoMethod(ST_Gad2,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Treib,3,MUIM_Set,MUIA_Window_ActiveObject,ST_Gad3);
DoMethod(ST_Gad3,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Treib,3,MUIM_Set,MUIA_Window_ActiveObject,ST_Gad4);
DoMethod(BT_UN_New, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_UN_NEW);
DoMethod(BT_UN_Change, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_UN_CHANGE);
DoMethod(BT_UN_Delete, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_UN_DELETE);
DoMethod(BT_UN_Cancel, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, ID_UN_CANCEL);
DoMethod(BT_UN_Close, MUIM_Notify, MUIA_Pressed, FALSE,
App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
DoMethod(ST_Gad5, MUIM_Notify, MUIA_String_Acknowledge,MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_UN_DATE);
DoMethod(ST_Gad8, MUIM_Notify, MUIA_String_Acknowledge,MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_UN_REMARK);
/* 13.1.96 Probleme, evt. mit MUI3.1. Das automatische Aktivieren
des nächsten Gadgets funktioniert bei den Unterhalts-
sachen nicht ??? Daher von Hand */
DoMethod(ST_Gad6, MUIM_Notify, MUIA_String_Acknowledge,MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_UN_PRICE);
DoMethod(ST_Gad7, MUIM_Notify, MUIA_String_Acknowledge,MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_UN_TITLE);
DoMethod(ST_Gad6,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Treib,3,MUIM_Set,MUIA_Window_ActiveObject,ST_Gad7);
DoMethod(ST_Gad7,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
WI_Treib,3,MUIM_Set,MUIA_Window_ActiveObject,ST_Gad8);
DoMethod(WI_Cost,MUIM_Window_SetCycleChain,
BT_Treib, BT_Unter, NULL);
DoMethod(WI_Treib,MUIM_Window_SetCycleChain,
LV_Treib, ST_Gad1, ST_Gad2, ST_Gad3, ST_Gad4,
BT_TR_New, BT_TR_Change, BT_TR_Delete, BT_TR_Close, NULL);
DoMethod(WI_Unter,MUIM_Window_SetCycleChain,
LV_Unter, ST_Gad5, ST_Gad6, ST_Gad7, ST_Gad8,
BT_UN_New, BT_UN_Change, BT_UN_Delete, BT_UN_Close, NULL);
DoMethod(WI_Neu,MUIM_Window_SetCycleChain,
NE_Gad1, NE_Gad2, NE_Gad3, NE_Gad4, NE_OK, NE_Cancel, NULL);
DoMethod(LV_Treib, MUIM_Notify, MUIA_Listview_DoubleClick,
MUIV_EveryTime, App, 2, MUIM_Application_ReturnID, ID_TR_CHANGE);
DoMethod(LV_Unter, MUIM_Notify, MUIA_Listview_DoubleClick,
MUIV_EveryTime, App, 2, MUIM_Application_ReturnID, ID_UN_CHANGE);
DoMethod(LI_Treib, MUIM_Notify, MUIA_List_Active,
MUIV_EveryTime, App, 2, MUIM_Application_ReturnID, ID_TR_ACTIVE);
DoMethod(LV_Treib, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_TR_CHANGE);
DoMethod(LV_Unter, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
App, 2, MUIM_Application_ReturnID, ID_UN_CHANGE);
set(WI_Cost,MUIA_Window_Open,TRUE);
{
LONG test=0;
get(WI_Cost,MUIA_Window_Open,&test);
if(!test)
{
ShowRequest2(0,TEXT(MSG_ERROR),
TEXT(MSG_ERROR_WINDOWOPEN),
TEXT(MSG_OK_TEXT));
}
}
if(DiskObj) set(App, MUIA_Application_DiskObject, DiskObj);
}
return((LONG)App);
}